Skip to content

fix: verify spruce binary checksum during installation - #2343

Open
paramcodes wants to merge 1 commit into
shipwright-io:mainfrom
paramcodes:bug/verify-spruce-download
Open

fix: verify spruce binary checksum during installation#2343
paramcodes wants to merge 1 commit into
shipwright-io:mainfrom
paramcodes:bug/verify-spruce-download

Conversation

@paramcodes

@paramcodes paramcodes commented Sep 7, 2026

Copy link
Copy Markdown

Changes

This PR resolves #2328 by verifying the Spruce binary against its published SHA-1 checksum during installation before placing it at the target path or making it executable.

Details

  • hack/install-spruce.sh:
    • Discovers both the Spruce binary and its matching .sha1 checksum release assets.
    • Adds checks to prevent proceeding if assets are missing or null.
    • Normalizes system architecture (aarch64 -> arm64, x86_64 -> amd64).
    • Stages downloads in a temporary file (mktemp) with an EXIT trap for cleanup.
    • Verifies the checksum using sha1sum --check on Linux and shasum --algorithm 1 --check on Darwin.
    • Atomically moves the validated binary to ${TARGET_DIR}/spruce and sets chmod a+rx.
  • hack/install-spruce_test.sh:
    • Added hermetic regression tests covering valid checksums, checksum mismatches, missing checksums, and macOS Darwin shasum detection.
  • Makefile:
    • Added test-install-spruce target.
  • .github/workflows/verify.yaml:
    • Added test-install-spruce step to the Verify workflow.

Related Issue

Fixes #2328

Type of PR

/kind bug

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Kind label has been set
  • Release notes block has been filled in, or marked NONE

Release Notes

NONE

Verify the downloaded Spruce binary against its published SHA-1 checksum
before placing it in the target directory and marking it executable.
Add regression tests covering valid checksums, checksum mismatches,
Darwin shasum usage, and missing checksum assets.

Fixes shipwright-io#2328

Signed-off-by: paramcodes <sparamveer1001@gmail.com>
@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 7, 2026
@openshift-ci
openshift-ci Bot requested review from dorzel and rxinui September 7, 2026 17:50
@openshift-ci

openshift-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign heavywombat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Sep 7, 2026
@openshift-ci openshift-ci Bot added release-note-none Label for when a PR does not need a release note and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 7, 2026
@Ankit-cs Ankit-cs mentioned this pull request Sep 7, 2026
2 tasks
@paramcodes

Copy link
Copy Markdown
Author

@kaizakin can you review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Label for when a PR does not need a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Spruce installer does not verify the downloaded binary

2 participants